home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-05 | 2.8 KB | 101 lines | [TEXT/MMCC] |
- //
- // CTCPDriver.h
- //
- // TurboTCP library
- // TCP driver interface class
- //
- // Copyright © 1993-95, FrostByte Design / Eric Scouten
- //
-
-
- #pragma once
-
- #include "TurboTCP.buildflags.h"
- #include "TurboTCP.types.h"
- #include <OSUtils.h>
-
- #if TurboTCP_UH2
- #include <MacTCP.h>
- #else
- #include <MacTCPCommonTypes.h>
- #endif
-
-
- class CTCPAsyncCall;
- class CTCPDriver;
- class CTCPStream;
- class CTCPResolverCall;
-
-
- //***********************************************************
-
- class CTCPDriver {
-
- // This object performs all of the housekeeping associated with the MacTCP driver.
- // It keeps track of all currently open streams and handles the delayed-processing of
- // MacTCP completions and notifications. It is also responsible for seeing that MacTCP is
- // in a stable state (i.e. no streams left open, DNR closed) before the application quits.
-
- // NOTE: This class is intended for the internal use of other TurboTCP classes only.
- // Accordingly, all of its methods are declared private and friend class declarations are
- // used to make its members available as appropriate. No user class should have a reason
- // to use this object, nor should this object be subclassed.
-
- // In a future version of TurboTCP, this class will be made an abstract class to support
- // MacTCP and Open Transport versions of the driver object.
-
- friend class CTCPAsyncCall;
- friend class CTCPStream;
- friend class CTCPResolverCall;
- friend class UTurboTCP;
-
- private:
- CTCPDriver();
- virtual ~CTCPDriver() {} // don’t use this -- use Dispose() instead
- void Dispose();
-
- // event handling
-
- Boolean ProcessOneNetEvent();
-
- // TCP verification routines
-
- ip_addr GetIPAddr();
- Boolean CheckTCPDriver();
- Boolean CheckResolver();
- short GetTCPRefNum();
- void FetchIPAddr();
-
- // tracking active streams/resolvers
-
- void RegisterActiveStream(CTCPStream* theStream);
- void RegisterActiveResolver(CTCPResolverCall* theResolver);
- void RemoveActiveStream(CTCPStream* theStream);
- void RemoveActiveResolver(CTCPResolverCall* theResolver);
- Boolean CheckResolverLimit();
-
-
- // data members
-
- private:
- static CTCPDriver* gTCPDriver; // global reference to this object
- Boolean hasMacTCP; // is there a MacTCP driver available?
- Boolean hasResolver; // is the DNR code segment available?
- short myTCPRefNum; // MacTCP driver’s ioRefNum
- ip_addr myIPAddress; // our IP address
- QHdr asyncQueue; // interrupt-event queue
- QHdr activeStreamList; // list of active TCP streams
- QHdr activeResolverList; // list of active DNR calls
- short activeResolverCount; // number of active DNR calls
-
-
- // private constants and types
-
- enum {
- maxResolverCalls = 8, // maximum DNR calls open simultaneously
- DLOG_TCPDelayedQuit = 23010 // delay message
- };
-
-
- };
-